home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q1082.dms / q1082.adf / src.lzh / Fig / trans.c < prev    next >
C/C++ Source or Header  |  1991-07-18  |  3KB  |  154 lines

  1. /* 
  2.  *    FIG : Facility for Interactive Generation of figures
  3.  *
  4.  *    Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
  5.  *    January 1985.
  6.  *    1st revision : Aug 1985.
  7.  *
  8.  *    %W%    %G%
  9. */
  10. #include "fig.h"
  11. #include "object.h"
  12.  
  13. translate_ellipse(ellipse, dx, dy)
  14. F_ellipse    *ellipse;
  15. int        dx, dy;
  16. {
  17.     ellipse->center.x += dx;
  18.     ellipse->center.y += dy;
  19.     ellipse->start.x += dx;
  20.     ellipse->start.y += dy;
  21.     ellipse->end.x += dx;
  22.     ellipse->end.y += dy;
  23.     }
  24.  
  25. translate_arc(arc, dx, dy)
  26. F_arc    *arc;
  27. int    dx, dy;
  28. {
  29.     arc->center.x += (float)dx;
  30.     arc->center.y += (float)dy;
  31.     arc->point[0].x += dx;
  32.     arc->point[0].y += dy;
  33.     arc->point[1].x += dx;
  34.     arc->point[1].y += dy;
  35.     arc->point[2].x += dx;
  36.     arc->point[2].y += dy;
  37.     }
  38.  
  39. translate_line(line, dx, dy)
  40. F_line    *line;
  41. int    dx, dy;
  42. {
  43.         F_point    *point;
  44.  
  45.         for (point = line->points; point != NULL; point = point->next) {
  46.         point->x += dx;
  47.         point->y += dy;
  48.             }
  49.     }
  50.  
  51. translate_text(text, dx, dy)
  52. F_text    *text;
  53. int    dx, dy;
  54. {
  55.     text->base_x += dx;
  56.     text->base_y += dy;
  57.     }
  58.  
  59. translate_spline(spline, dx, dy)
  60. F_spline    *spline;
  61. int        dx, dy;
  62. {
  63.         F_point        *point;
  64.     F_control    *cp;
  65.  
  66.         for (point = spline->points; point != NULL; point = point->next) {
  67.         point->x += dx;
  68.         point->y += dy;
  69.             }
  70.         for (cp = spline->controls; cp != NULL; cp = cp->next) {
  71.         cp->lx += dx;
  72.         cp->ly += dy;
  73.         cp->rx += dx;
  74.         cp->ry += dy;
  75.             }
  76.     }
  77.  
  78. translate_compound(compound, dx, dy)
  79. F_compound    *compound;
  80. int        dx, dy;
  81. {
  82.     compound->nwcorner.x += dx;
  83.     compound->nwcorner.y += dy;
  84.     compound->secorner.x += dx;
  85.     compound->secorner.y += dy;
  86.  
  87.     translate_lines(compound->lines, dx, dy);
  88.     translate_splines(compound->splines, dx, dy);
  89.     translate_ellipses(compound->ellipses, dx, dy);
  90.     translate_arcs(compound->arcs, dx, dy);
  91.     translate_texts(compound->texts, dx, dy);
  92.     translate_compounds(compound->compounds, dx, dy);
  93.     }
  94.  
  95. translate_arcs(arcs, dx, dy)
  96. F_arc    *arcs;
  97. int    dx, dy;
  98. {
  99.     F_arc    *a;
  100.  
  101.     for (a = arcs; a != NULL; a = a-> next) 
  102.         translate_arc(a, dx, dy);
  103.     }
  104.  
  105. translate_compounds(compounds, dx, dy)
  106. F_compound    *compounds;
  107. int        dx, dy;
  108. {
  109.     F_compound    *c;
  110.  
  111.     for (c = compounds; c != NULL; c = c->next) 
  112.         translate_compound(c, dx, dy);
  113.     }
  114.  
  115. translate_ellipses(ellipses, dx, dy)
  116. F_ellipse    *ellipses;
  117. int        dx, dy;
  118. {
  119.     F_ellipse    *e;
  120.  
  121.     for (e = ellipses; e != NULL; e = e-> next)
  122.         translate_ellipse(e, dx, dy);
  123.     }
  124.  
  125. translate_lines(lines, dx, dy)
  126. F_line    *lines;
  127. int    dx, dy;
  128. {
  129.     F_line    *l;
  130.  
  131.     for (l = lines; l != NULL; l = l->next) translate_line(l, dx, dy);
  132.     }
  133.  
  134. translate_splines(splines, dx, dy)
  135. F_spline    *splines;
  136. int        dx, dy;
  137. {
  138.     F_spline    *s;
  139.  
  140.     for (s = splines; s != NULL; s = s->next)
  141.         translate_spline(s, dx, dy);
  142.     }
  143.  
  144. translate_texts(texts, dx, dy)
  145. F_text    *texts;
  146. int    dx, dy;
  147. {
  148.     F_text    *t;
  149.  
  150.     for (t = texts; t != NULL; t = t->next)
  151.         translate_text(t, dx, dy);
  152.     }
  153.  
  154.